Setup
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(R.utils)
library(wbCorr)
library(readxl)
library(kableExtra)
library(brms)
library(bayesplot)
top_directory <- file.path(
'C:', 'Users', 'kueng', 'OneDrive - Universität Zürich UZH',
'04 Papers', '02 T&T Control', 'Analysis', 'ACTIVITY', 'BRMS'
)
working_directory <- file.path(top_directory, 'SensitivityCovariates')
setwd(working_directory)
functions_directory <- file.path('C:', 'Users', 'kueng',
'OneDrive - Universität Zürich UZH',
'RFunctions')
source(file.path(functions_directory, 'ReportModels.R'))
source(file.path(functions_directory, 'PrettyTables.R'))
source(file.path(functions_directory, 'ReportMeasures.R'))
source(file.path(top_directory, 'Functions', 'PrepareData.R'))
## [1] 1116
# Set options for analysis
use_mi = FALSE
shutdown = FALSE
report_ordinal = FALSE
options(
dplyr.print_max = 100,
brms.backend = 'cmdstan',
brms.file_refit = ifelse(use_mi, 'never', 'on_change'),
error = function() beepr::beep(sound = 5)
)
df <- openxlsx::read.xlsx(file.path(top_directory, 'long.xlsx'))
df_original <- df
df_double <- prepare_data(df, use_mi = use_mi)[[1]]
Constructing scales Re-coding pusing reshaping data (4field)
centering data within and between
Modelling
# For indistinguishable Dyads
model_rows_fixed <- c(
'Intercept',
# '-- WITHIN PERSON MAIN EFFECTS --',
'persuasion_self_cw',
'persuasion_partner_cw',
'pressure_self_cw',
'pressure_partner_cw',
'pushing_self_cw',
'pushing_partner_cw',
'day',
'weartime_self_cw',
'support_self_cw',
'support_partner_cw',
'isWeekendWeekend',
'got_JITAI_selfJITAIreceived',
'skilled_supportDaysafterIntervention',
# '-- BETWEEN PERSON MAIN EFFECTS',
'persuasion_self_cb',
'persuasion_partner_cb',
'pressure_self_cb',
'pressure_partner_cb',
'pushing_self_cb',
'pushing_partner_cb',
'weartime_self_cb',
'studyGroupFirst3weeksinterventions',
'studyGrouplast3weeksinterventions'
)
model_rows_fixed_ordinal <- c(
model_rows_fixed[1],
'Intercept[1]',
'Intercept[2]',
'Intercept[3]',
'Intercept[4]',
'Intercept[5]',
model_rows_fixed[2:length(model_rows_fixed)]
)
model_rows_random <- c(
# '--------------',
# '-- RANDOM EFFECTS --',
'sd(Intercept)',
'sd(persuasion_self_cw)',
'sd(persuasion_partner_cw)',
'sd(pressure_self_cw)',
'sd(pressure_partner_cw)',
'sd(pushing_self_cw)',
'sd(pushing_partner_cw)',
# '-- CORRELATION STRUCTURE -- ',
'ar[1]',
'nu',
'shape',
'sderr',
'sigma'
)
model_rows_random_ordinal <- c(model_rows_random,'disc')
# For indistinguishable Dyads
model_rownames_fixed <- c(
'Intercept',
# '-- WITHIN PERSON MAIN EFFECTS --',
'Daily perceived persuasion target -> target',
'Daily perceived persuasion target -> agent',
'Daily perceived pressure target -> target',
'Daily perceived pressure target -> agent',
'Daily perceived pushing target -> target',
'Daily perceived pushing target -> agent',
'Day',
'Daily weartime',
'Daily perceived support target -> target',
'Daily perceived support target -> agent',
'Is a weekend',
'JITAI received',
'Days post skilled support intervention',
# '-- BETWEEN PERSON MAIN EFFECTS',
'Mean perceived persuasion target -> target',
'Mean Perceived persuasion target -> agent',
'Mean Perceived pressure target -> target',
'Mean Perceived pressure target -> agent',
'Mean Perceived pushing target -> target',
'Mean Perceived pushing target -> agent',
'Mean weartime',
'Difference study group 2',
'Difference study group 3'
)
model_rownames_fixed_ordinal <- c(
model_rownames_fixed[1],
'Intercept[1]',
'Intercept[2]',
'Intercept[3]',
'Intercept[4]',
'Intercept[5]',
model_rownames_fixed[2:length(model_rownames_fixed)]
)
model_rownames_random <- c(
# '--------------',
# '-- RANDOM EFFECTS --',
'sd(Intercept)',
'sd(Daily perceived persuasion target -> target)',
'sd(Daily perceived persuasion target -> agent)',
'sd(Daily perceived pressure target -> target)',
'sd(Daily perceived pressure target -> agent)',
'sd(Daily perceived pushing target -> target)',
'sd(Daily perceived pushing target -> agent)',
# '-- CORRELATION STRUCTURE -- ',
'ar[1]',
'nu',
'shape',
'sderr',
'sigma'
)
model_rownames_random_ordinal <- c(model_rownames_random,'disc')
rows_to_pack <- list(
"Within-Person Effects" = c(2,14),
"Between-Person Effects" = c(15,23),
"Random Effects" = c(24, 30),
"Additional Parameters" = c(31,35)
)
rows_to_pack_ordinal <- list(
"Intercepts" = c(1,6),
"Within-Person Effects" = c(2+5,14+5),
"Between-Person Effects" = c(15+5,23+5),
"Random Effects" = c(24+5, 30+5),
"Additional Parameters" = c(31+5,35+6)
)
Subjective MVPA
range(df_double$pa_sub, na.rm = T)
## [1] 0 720
hist(df_double$pa_sub, breaks = 100)

Modelling using the gaussian family fails. Due to the many zeros,
transformations won’t help estimating the models. We employ the negative
binomial family.
formula <- bf(
pa_sub ~
persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw +
#barriers_self_cw +
#support_self_cw + support_partner_cw +
#comf_self_cw + reas_self_cw +
isWeekend +
got_JITAI_self + skilled_support +
persuasion_self_cb + persuasion_partner_cb +
pressure_self_cb + pressure_partner_cb +
pushing_self_cb + pushing_partner_cb +
studyGroup +
day +
# Random effects
(persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw | coupleID),
autocor = ~ ar(time = day, gr = coupleID:userID, p = 1)
)
prior1 <- c(
brms::set_prior("normal(0, 2.5)", class = "b"),
brms::set_prior("normal(0, 50)", class = "Intercept", lb = 0),
brms::set_prior("normal(0, 10)", class = "sd", group = "coupleID", lb = 0),
brms::set_prior("cauchy(0, 5)", class = "ar", lb = -1, ub = 1),
brms::set_prior("cauchy(0, 20)", class = "shape"),
brms::set_prior("cauchy(0, 10)", class='sderr')
)
#df_minimal <- df_double[, c("userID", all.vars(as.formula(formula)))]
pa_sub <- my_brm(
mi = use_mi,
imputed_data = implist,
formula = formula,
prior = prior1,
data = df_double,
family = brms::negbinomial(),
#control = list(adapt_delta = 0.99),
iter = 5000,
warmup = 2000,
chains = 4,
cores = 4,
seed = 7777,
file = file.path(working_directory, "models_cache", "NoExchangeProcesses_pa_sub")
)
pp_check(pa_sub, type='hist')
## Using 10 posterior draws for ppc type 'hist' by default.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

##
## Computed from 12000 by 3736 log-likelihood matrix.
##
## Estimate SE
## elpd_loo -12058.6 177.6
## p_loo 31.5 2.9
## looic 24117.2 355.2
## ------
## MCSE of elpd_loo is NA.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.3, 1.8]).
##
## Pareto k diagnostic values:
## Count Pct. Min. ESS
## (-Inf, 0.7] (good) 3730 99.8% 711
## (0.7, 1] (bad) 6 0.2% <NA>
## (1, Inf) (very bad) 0 0.0% <NA>
## See help('pareto-k-diagnostic') for details.
plot(pa_sub, ask = FALSE)










summarize_brms(
pa_sub,
model_rows_fixed = model_rows_fixed,
model_rows_random = model_rows_random,
model_rownames_fixed = model_rownames_fixed,
model_rownames_random = model_rownames_random,
exponentiate = T) %>%
print_df(rows_to_pack = rows_to_pack)
|
|
IRR
|
l-95% CI
|
u-95% CI
|
Rhat
|
Bulk_ESS
|
Tail_ESS
|
|
Intercept
|
25.01*
|
16.31
|
38.47
|
1.001
|
4149.37
|
6899.00
|
|
Within-Person Effects
|
|
Daily perceived persuasion target -> target
|
1.20*
|
1.08
|
1.35
|
1.001
|
13815.80
|
8955.73
|
|
Daily perceived persuasion target -> agent
|
1.18*
|
1.06
|
1.33
|
1.000
|
13125.08
|
8597.14
|
|
Daily perceived pressure target -> target
|
0.93
|
0.70
|
1.28
|
1.001
|
10776.56
|
8213.55
|
|
Daily perceived pressure target -> agent
|
1.17
|
0.88
|
1.60
|
1.001
|
12278.39
|
8112.98
|
|
Daily perceived pushing target -> target
|
1.13
|
0.92
|
1.41
|
1.000
|
9634.92
|
7950.68
|
|
Daily perceived pushing target -> agent
|
1.14
|
0.97
|
1.36
|
1.000
|
13542.44
|
9570.66
|
|
Day
|
0.78
|
0.51
|
1.20
|
1.000
|
9287.04
|
9292.82
|
|
Daily weartime
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Daily perceived support target -> target
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Daily perceived support target -> agent
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Is a weekend
|
1.26*
|
1.03
|
1.53
|
1.000
|
14997.04
|
8575.03
|
|
JITAI received
|
0.78
|
0.60
|
1.02
|
1.000
|
15416.78
|
8877.06
|
|
Days post skilled support intervention
|
1.07
|
0.77
|
1.47
|
1.000
|
9720.75
|
9233.75
|
|
Between-Person Effects
|
|
Mean perceived persuasion target -> target
|
1.64
|
0.84
|
3.21
|
1.000
|
3603.33
|
5293.90
|
|
Mean Perceived persuasion target -> agent
|
1.22
|
0.64
|
2.35
|
1.001
|
3737.59
|
5250.52
|
|
Mean Perceived pressure target -> target
|
0.50
|
0.23
|
1.09
|
1.001
|
5097.65
|
7541.12
|
|
Mean Perceived pressure target -> agent
|
0.44*
|
0.20
|
0.96
|
1.001
|
5325.89
|
7099.34
|
|
Mean Perceived pushing target -> target
|
1.69
|
0.63
|
4.56
|
1.001
|
4748.82
|
6354.96
|
|
Mean Perceived pushing target -> agent
|
1.84
|
0.68
|
5.27
|
1.000
|
4664.11
|
6870.92
|
|
Mean weartime
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Difference study group 2
|
0.84
|
0.49
|
1.44
|
1.000
|
3262.86
|
5465.59
|
|
Difference study group 3
|
1.27
|
0.74
|
2.16
|
1.000
|
3826.49
|
6450.90
|
|
Random Effects
|
|
sd(Intercept)
|
0.61
|
0.45
|
0.83
|
1.00
|
4052.17
|
6511.73
|
|
sd(Daily perceived persuasion target -> target)
|
0.09
|
0.00
|
0.23
|
1.00
|
4880.75
|
4697.28
|
|
sd(Daily perceived persuasion target -> agent)
|
0.07
|
0.00
|
0.20
|
1.00
|
5781.38
|
5337.32
|
|
sd(Daily perceived pressure target -> target)
|
0.17
|
0.01
|
0.53
|
1.00
|
6966.79
|
6255.09
|
|
sd(Daily perceived pressure target -> agent)
|
0.16
|
0.01
|
0.48
|
1.00
|
7092.20
|
5410.81
|
|
sd(Daily perceived pushing target -> target)
|
0.28
|
0.02
|
0.58
|
1.00
|
3041.60
|
3386.28
|
|
sd(Daily perceived pushing target -> agent)
|
0.11
|
0.01
|
0.31
|
1.00
|
6199.16
|
5183.10
|
|
Additional Parameters
|
|
ar[1]
|
0.03
|
-0.94
|
0.94
|
1.00
|
11290.35
|
7161.12
|
|
nu
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
shape
|
0.14
|
0.13
|
0.14
|
1.00
|
16673.86
|
8356.42
|
|
sderr
|
0.05
|
0.00
|
0.14
|
1.00
|
6501.87
|
5199.07
|
|
sigma
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
Device Based MVPA
range(df_double$pa_obj, na.rm = T)
## [1] 5.75 971.25
hist(df_double$pa_obj, breaks = 50)

df_double$pa_obj_log <- log(df_double$pa_obj)
hist(df_double$pa_obj_log, breaks = 50)

We tried negative binomial here as well for consistency, but the
model did not converge. Poisson also did not work. As we have no zeros
in this distribution, we log transform.
formula <- bf(
pa_obj_log ~
persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw +
#barriers_self_cw +
#support_self_cw + support_partner_cw +
#comf_self_cw + reas_self_cw +
isWeekend +
got_JITAI_self + skilled_support +
persuasion_self_cb + persuasion_partner_cb +
pressure_self_cb + pressure_partner_cb +
pushing_self_cb + pushing_partner_cb +
studyGroup +
day + weartime_self_cw + weartime_self_cb +
# Random effects
(persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw | coupleID),
autocor = ~ ar(time = day, gr = coupleID:userID, p = 1)
)
prior1 <- c(
brms::set_prior("normal(0, 2.5)", class = "b"),
brms::set_prior("normal(0, 50)", class = "Intercept", lb = 0),
brms::set_prior("normal(0, 10)", class = "sd", group = "coupleID", lb = 0),
brms::set_prior("cauchy(0, 5)", class = "ar", lb = -1, ub = 1),
brms::set_prior("cauchy(0, 10)", class = "sigma", lb = 0)
)
#df_minimal <- df_double[, c("userID", all.vars(as.formula(formula)))]
pa_obj_log <- my_brm(
mi = use_mi,
imputed_data = implist,
formula = formula,
prior = prior1,
data = df_double,
family = gaussian(),
#control = list(adapt_delta = 0.99),
iter = 5000,
warmup = 2000,
chains = 4,
cores = 4,
seed = 7777,
file = file.path(working_directory,"models_cache", "NoExchangeProcesses_pa_obj_log")
)
# plotting with the first imputed dataset.
pp_check(pa_obj_log, type='hist')
## Using 10 posterior draws for ppc type 'hist' by default.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

##
## Computed from 12000 by 3337 log-likelihood matrix.
##
## Estimate SE
## elpd_loo -2810.4 56.8
## p_loo 94.7 4.7
## looic 5620.8 113.5
## ------
## MCSE of elpd_loo is 0.1.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.3, 1.9]).
##
## All Pareto k estimates are good (k < 0.7).
## See help('pareto-k-diagnostic') for details.
plot(pa_obj_log, ask = FALSE)











summarize_brms(
pa_obj_log,
model_rows_fixed = model_rows_fixed,
model_rows_random = model_rows_random,
model_rownames_fixed = model_rownames_fixed,
model_rownames_random = model_rownames_random,
exponentiate = T) %>%
print_df(rows_to_pack = rows_to_pack)
|
|
exp(Est.)
|
l-95% CI
|
u-95% CI
|
Rhat
|
Bulk_ESS
|
Tail_ESS
|
|
Intercept
|
120.79*
|
100.83
|
145.18
|
1.000
|
4239.20
|
6209.51
|
|
Within-Person Effects
|
|
Daily perceived persuasion target -> target
|
1.03
|
1.00
|
1.05
|
1.001
|
12390.20
|
10544.56
|
|
Daily perceived persuasion target -> agent
|
1.01
|
0.99
|
1.04
|
1.000
|
14962.92
|
9550.28
|
|
Daily perceived pressure target -> target
|
0.95
|
0.89
|
1.01
|
1.000
|
19051.70
|
9387.28
|
|
Daily perceived pressure target -> agent
|
0.98
|
0.92
|
1.04
|
1.000
|
20150.84
|
9560.53
|
|
Daily perceived pushing target -> target
|
1.03
|
0.98
|
1.08
|
1.000
|
15472.49
|
8561.84
|
|
Daily perceived pushing target -> agent
|
1.03
|
0.99
|
1.07
|
1.000
|
18983.33
|
9512.96
|
|
Day
|
0.94
|
0.83
|
1.05
|
1.000
|
17456.49
|
9555.89
|
|
Daily weartime
|
1.00*
|
1.00
|
1.00
|
1.000
|
11809.03
|
7727.81
|
|
Daily perceived support target -> target
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Daily perceived support target -> agent
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Is a weekend
|
1.06*
|
1.02
|
1.11
|
1.001
|
30803.57
|
8741.86
|
|
JITAI received
|
0.93*
|
0.88
|
0.98
|
1.001
|
29224.44
|
8422.62
|
|
Days post skilled support intervention
|
1.04
|
0.96
|
1.14
|
1.000
|
17346.08
|
10340.33
|
|
Between-Person Effects
|
|
Mean perceived persuasion target -> target
|
1.07
|
0.79
|
1.45
|
1.001
|
3976.33
|
5874.57
|
|
Mean Perceived persuasion target -> agent
|
0.95
|
0.70
|
1.29
|
1.001
|
3841.11
|
5642.70
|
|
Mean Perceived pressure target -> target
|
0.98
|
0.70
|
1.37
|
1.001
|
5542.79
|
7814.95
|
|
Mean Perceived pressure target -> agent
|
1.00
|
0.73
|
1.38
|
1.001
|
5235.22
|
7668.65
|
|
Mean Perceived pushing target -> target
|
1.03
|
0.66
|
1.61
|
1.000
|
5493.05
|
7623.64
|
|
Mean Perceived pushing target -> agent
|
1.30
|
0.83
|
2.03
|
1.000
|
5534.05
|
7234.52
|
|
Mean weartime
|
1.00
|
1.00
|
1.00
|
1.000
|
17389.53
|
9548.63
|
|
Difference study group 2
|
0.89
|
0.69
|
1.15
|
1.000
|
3542.44
|
5972.18
|
|
Difference study group 3
|
0.98
|
0.75
|
1.26
|
1.001
|
4327.24
|
6229.46
|
|
Random Effects
|
|
sd(Intercept)
|
0.30
|
0.23
|
0.40
|
1.00
|
3530.98
|
5797.86
|
|
sd(Daily perceived persuasion target -> target)
|
0.05
|
0.03
|
0.08
|
1.00
|
6646.03
|
5917.60
|
|
sd(Daily perceived persuasion target -> agent)
|
0.05
|
0.02
|
0.08
|
1.00
|
5928.57
|
5562.21
|
|
sd(Daily perceived pressure target -> target)
|
0.05
|
0.00
|
0.14
|
1.00
|
6617.04
|
7769.32
|
|
sd(Daily perceived pressure target -> agent)
|
0.04
|
0.00
|
0.11
|
1.00
|
7848.04
|
7410.27
|
|
sd(Daily perceived pushing target -> target)
|
0.06
|
0.00
|
0.15
|
1.00
|
2831.10
|
4983.82
|
|
sd(Daily perceived pushing target -> agent)
|
0.03
|
0.00
|
0.08
|
1.00
|
6349.87
|
6731.72
|
|
Additional Parameters
|
|
ar[1]
|
0.30
|
0.26
|
0.33
|
1.00
|
27789.17
|
9023.27
|
|
nu
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
shape
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
sderr
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
sigma
|
0.55
|
0.54
|
0.57
|
1.00
|
25699.80
|
8389.43
|
Affect
range(df_double$aff, na.rm = T)
## [1] 1 6
hist(df_double$aff, breaks = 15)

formula <- bf(
aff ~
persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw +
#barriers_self_cw +
#support_self_cw + support_partner_cw +
#comf_self_cw + reas_self_cw +
isWeekend +
got_JITAI_self + skilled_support +
persuasion_self_cb + persuasion_partner_cb +
pressure_self_cb + pressure_partner_cb +
pushing_self_cb + pushing_partner_cb +
studyGroup +
day +
# Random effects
(persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw | coupleID),
autocor = ~ ar(time = day, gr = coupleID:userID, p = 1)
)
prior1 <- c(
brms::set_prior("normal(0, 5)", class = "b"),
brms::set_prior("normal(0, 20)", class = "Intercept", lb=0, ub=6), # range of the outcome scale
brms::set_prior("normal(0, 2)", class = "sd", group = "coupleID", lb = 0),
brms::set_prior("cauchy(0, 5)", class = "ar", lb = -1, ub = 1),
brms::set_prior("cauchy(0, 10)", class = "sigma", lb = 0)
)
df_minimal <- df_double[, c("userID", all.vars(as.formula(formula)))]
mood <- my_brm(
mi = use_mi,
imputed_data = implist,
formula = formula,
prior = prior1,
data = df_double,
family = gaussian(),
#control = list(adapt_delta = 0.95, max_treedepth = 15),
iter = 5000,
warmup = 2000,
chains = 4,
cores = 4,
seed = 7777,
file = file.path(working_directory,"models_cache", "NoExchangeProcesses_mood")
)
pp_check(mood, type='hist')
## Using 10 posterior draws for ppc type 'hist' by default.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

##
## Computed from 12000 by 3736 log-likelihood matrix.
##
## Estimate SE
## elpd_loo -4811.7 63.8
## p_loo 92.9 4.7
## looic 9623.3 127.6
## ------
## MCSE of elpd_loo is 0.1.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.5, 1.5]).
##
## All Pareto k estimates are good (k < 0.7).
## See help('pareto-k-diagnostic') for details.










summarize_brms(
mood,
model_rows_fixed = model_rows_fixed,
model_rows_random = model_rows_random,
model_rownames_fixed = model_rownames_fixed,
model_rownames_random = model_rownames_random,
exponentiate = F) %>%
print_df(rows_to_pack = rows_to_pack)
|
|
b
|
l-95% CI
|
u-95% CI
|
Rhat
|
Bulk_ESS
|
Tail_ESS
|
|
Intercept
|
4.64*
|
4.31
|
4.97
|
1.001
|
5416.97
|
7206.82
|
|
Within-Person Effects
|
|
Daily perceived persuasion target -> target
|
0.00
|
-0.03
|
0.03
|
1.000
|
17624.62
|
9084.58
|
|
Daily perceived persuasion target -> agent
|
0.01
|
-0.03
|
0.05
|
1.000
|
18226.01
|
10360.31
|
|
Daily perceived pressure target -> target
|
-0.05
|
-0.17
|
0.05
|
1.000
|
14620.65
|
9742.35
|
|
Daily perceived pressure target -> agent
|
-0.04
|
-0.18
|
0.09
|
1.000
|
12496.42
|
9495.99
|
|
Daily perceived pushing target -> target
|
0.02
|
-0.04
|
0.09
|
1.000
|
17337.89
|
9901.67
|
|
Daily perceived pushing target -> agent
|
0.06*
|
0.01
|
0.12
|
1.000
|
17695.63
|
9700.51
|
|
Day
|
0.21
|
-0.01
|
0.43
|
1.000
|
20666.67
|
9041.60
|
|
Daily weartime
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Daily perceived support target -> target
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Daily perceived support target -> agent
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Is a weekend
|
0.12*
|
0.05
|
0.18
|
1.000
|
27503.98
|
9111.39
|
|
JITAI received
|
-0.09*
|
-0.16
|
-0.01
|
1.001
|
29559.03
|
8712.12
|
|
Days post skilled support intervention
|
0.04
|
-0.11
|
0.19
|
1.000
|
18426.54
|
8590.84
|
|
Between-Person Effects
|
|
Mean perceived persuasion target -> target
|
0.39
|
-0.18
|
0.94
|
1.001
|
4320.62
|
6530.57
|
|
Mean Perceived persuasion target -> agent
|
0.30
|
-0.26
|
0.86
|
1.001
|
3943.96
|
6447.24
|
|
Mean Perceived pressure target -> target
|
-0.30
|
-0.88
|
0.27
|
1.000
|
5611.55
|
8288.79
|
|
Mean Perceived pressure target -> agent
|
-0.31
|
-0.87
|
0.26
|
1.000
|
5342.63
|
7661.31
|
|
Mean Perceived pushing target -> target
|
0.16
|
-0.61
|
0.92
|
1.001
|
6877.67
|
8256.86
|
|
Mean Perceived pushing target -> agent
|
0.30
|
-0.46
|
1.07
|
1.001
|
6644.11
|
8503.66
|
|
Mean weartime
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Difference study group 2
|
-0.23
|
-0.67
|
0.21
|
1.000
|
5355.71
|
7115.82
|
|
Difference study group 3
|
0.37
|
-0.10
|
0.82
|
1.001
|
5077.59
|
6871.62
|
|
Random Effects
|
|
sd(Intercept)
|
0.55
|
0.42
|
0.72
|
1.00
|
5169.42
|
7380.36
|
|
sd(Daily perceived persuasion target -> target)
|
0.03
|
0.00
|
0.07
|
1.00
|
6266.44
|
6879.82
|
|
sd(Daily perceived persuasion target -> agent)
|
0.06
|
0.01
|
0.11
|
1.00
|
4029.33
|
5092.95
|
|
sd(Daily perceived pressure target -> target)
|
0.12
|
0.01
|
0.29
|
1.00
|
4182.12
|
6220.82
|
|
sd(Daily perceived pressure target -> agent)
|
0.18
|
0.02
|
0.37
|
1.00
|
4486.37
|
4469.96
|
|
sd(Daily perceived pushing target -> target)
|
0.09
|
0.01
|
0.17
|
1.00
|
5658.16
|
5434.46
|
|
sd(Daily perceived pushing target -> agent)
|
0.05
|
0.00
|
0.13
|
1.00
|
5847.72
|
6812.15
|
|
Additional Parameters
|
|
ar[1]
|
0.45
|
0.42
|
0.48
|
1.00
|
20615.58
|
8440.25
|
|
nu
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
shape
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
sderr
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
sigma
|
0.87
|
0.85
|
0.89
|
1.00
|
21994.40
|
7645.11
|
reactance
range(df_double$reactance, na.rm = T)
## [1] 0 5
hist(df_double$reactance, breaks = 6)

formula <- bf(
reactance ~
persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw +
#barriers_self_cw +
#support_self_cw + support_partner_cw +
#comf_self_cw + reas_self_cw +
isWeekend +
got_JITAI_self + skilled_support +
persuasion_self_cb + persuasion_partner_cb +
pressure_self_cb + pressure_partner_cb +
pushing_self_cb + pushing_partner_cb +
studyGroup +
day +
# Random effects
(persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw | coupleID),
autocor = ~ ar(time = day, gr = coupleID:userID, p = 1)
)
prior1 <- c(
brms::set_prior("normal(0, 5)", class = "b"),
brms::set_prior("normal(0, 20)", class = "Intercept", lb=0, ub=5), # range of the outcome scale
brms::set_prior("normal(0, 2)", class = "sd", group = "coupleID", lb = 0),
brms::set_prior("cauchy(0, 5)", class = "ar", lb = -1, ub = 1),
brms::set_prior("cauchy(0, 10)", class = "sigma", lb = 0)
)
df_minimal <- df_double[, c("userID", all.vars(as.formula(formula)))]
reactance <- my_brm(
mi = use_mi,
imputed_data = implist,
formula = formula,
prior = prior1,
data = df_double,
family = gaussian(),
#control = list(adapt_delta = 0.95, max_treedepth = 15),
iter = 5000,
warmup = 2000,
chains = 4,
cores = 4,
seed = 7777,
file = file.path(working_directory,"models_cache", "NoExchangeProcesses_reactance")
)
pp_check(reactance, type='hist')
## Using 10 posterior draws for ppc type 'hist' by default.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

##
## Computed from 12000 by 756 log-likelihood matrix.
##
## Estimate SE
## elpd_loo -1060.4 35.5
## p_loo 75.5 7.4
## looic 2120.8 70.9
## ------
## MCSE of elpd_loo is NA.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.5, 1.5]).
##
## Pareto k diagnostic values:
## Count Pct. Min. ESS
## (-Inf, 0.7] (good) 747 98.8% 132
## (0.7, 1] (bad) 9 1.2% <NA>
## (1, Inf) (very bad) 0 0.0% <NA>
## See help('pareto-k-diagnostic') for details.
plot(reactance, ask = FALSE)










## Family: gaussian
## Links: mu = identity; sigma = identity
## Formula: reactance ~ persuasion_self_cw + persuasion_partner_cw + pressure_self_cw + pressure_partner_cw + pushing_self_cw + pushing_partner_cw + isWeekend + got_JITAI_self + skilled_support + persuasion_self_cb + persuasion_partner_cb + pressure_self_cb + pressure_partner_cb + pushing_self_cb + pushing_partner_cb + studyGroup + day + (persuasion_self_cw + persuasion_partner_cw + pressure_self_cw + pressure_partner_cw + pushing_self_cw + pushing_partner_cw | coupleID)
## autocor ~ ar(time = day, gr = coupleID:userID, p = 1)
## Data: data (Number of observations: 756)
## Draws: 4 chains, each with iter = 5000; warmup = 2000; thin = 1;
## total post-warmup draws = 12000
##
## Correlation Structures:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## ar[1] 0.01 0.04 -0.08 0.09 1.00 14667 9441
##
## Multilevel Hyperparameters:
## ~coupleID (Number of levels: 38)
## Estimate Est.Error l-95% CI u-95% CI Rhat
## sd(Intercept) 0.19 0.08 0.04 0.36 1.00
## sd(persuasion_self_cw) 0.04 0.03 0.00 0.11 1.00
## sd(persuasion_partner_cw) 0.05 0.04 0.00 0.13 1.00
## sd(pressure_self_cw) 0.40 0.10 0.23 0.62 1.00
## sd(pressure_partner_cw) 0.22 0.16 0.01 0.58 1.00
## sd(pushing_self_cw) 0.12 0.06 0.01 0.24 1.00
## sd(pushing_partner_cw) 0.05 0.04 0.00 0.15 1.00
## cor(Intercept,persuasion_self_cw) -0.21 0.35 -0.80 0.53 1.00
## cor(Intercept,persuasion_partner_cw) 0.08 0.34 -0.61 0.70 1.00
## cor(persuasion_self_cw,persuasion_partner_cw) -0.03 0.35 -0.68 0.65 1.00
## cor(Intercept,pressure_self_cw) -0.00 0.30 -0.58 0.57 1.00
## cor(persuasion_self_cw,pressure_self_cw) 0.02 0.34 -0.64 0.66 1.00
## cor(persuasion_partner_cw,pressure_self_cw) 0.00 0.34 -0.65 0.65 1.00
## cor(Intercept,pressure_partner_cw) 0.07 0.33 -0.57 0.68 1.00
## cor(persuasion_self_cw,pressure_partner_cw) 0.05 0.35 -0.64 0.68 1.00
## cor(persuasion_partner_cw,pressure_partner_cw) 0.00 0.35 -0.66 0.67 1.00
## cor(pressure_self_cw,pressure_partner_cw) -0.18 0.32 -0.72 0.51 1.00
## cor(Intercept,pushing_self_cw) 0.18 0.31 -0.46 0.74 1.00
## cor(persuasion_self_cw,pushing_self_cw) -0.02 0.34 -0.66 0.64 1.00
## cor(persuasion_partner_cw,pushing_self_cw) 0.11 0.35 -0.58 0.73 1.00
## cor(pressure_self_cw,pushing_self_cw) -0.12 0.31 -0.67 0.50 1.00
## cor(pressure_partner_cw,pushing_self_cw) 0.08 0.36 -0.62 0.72 1.00
## cor(Intercept,pushing_partner_cw) 0.05 0.35 -0.62 0.70 1.00
## cor(persuasion_self_cw,pushing_partner_cw) 0.02 0.36 -0.66 0.69 1.00
## cor(persuasion_partner_cw,pushing_partner_cw) -0.03 0.36 -0.69 0.65 1.00
## cor(pressure_self_cw,pushing_partner_cw) -0.05 0.35 -0.70 0.63 1.00
## cor(pressure_partner_cw,pushing_partner_cw) 0.03 0.35 -0.64 0.69 1.00
## cor(pushing_self_cw,pushing_partner_cw) 0.04 0.35 -0.64 0.69 1.00
## Bulk_ESS Tail_ESS
## sd(Intercept) 3431 2862
## sd(persuasion_self_cw) 3634 5167
## sd(persuasion_partner_cw) 5652 5644
## sd(pressure_self_cw) 6502 8218
## sd(pressure_partner_cw) 3087 6599
## sd(pushing_self_cw) 3834 4180
## sd(pushing_partner_cw) 7144 6970
## cor(Intercept,persuasion_self_cw) 10285 9083
## cor(Intercept,persuasion_partner_cw) 16889 9733
## cor(persuasion_self_cw,persuasion_partner_cw) 13998 9771
## cor(Intercept,pressure_self_cw) 4275 6770
## cor(persuasion_self_cw,pressure_self_cw) 3297 6220
## cor(persuasion_partner_cw,pressure_self_cw) 3525 7020
## cor(Intercept,pressure_partner_cw) 9938 8724
## cor(persuasion_self_cw,pressure_partner_cw) 8763 9564
## cor(persuasion_partner_cw,pressure_partner_cw) 8508 8756
## cor(pressure_self_cw,pressure_partner_cw) 11488 9793
## cor(Intercept,pushing_self_cw) 7158 7475
## cor(persuasion_self_cw,pushing_self_cw) 7112 8016
## cor(persuasion_partner_cw,pushing_self_cw) 6696 9638
## cor(pressure_self_cw,pushing_self_cw) 9833 9525
## cor(pressure_partner_cw,pushing_self_cw) 6808 9599
## cor(Intercept,pushing_partner_cw) 19919 9019
## cor(persuasion_self_cw,pushing_partner_cw) 16633 9193
## cor(persuasion_partner_cw,pushing_partner_cw) 12144 9249
## cor(pressure_self_cw,pushing_partner_cw) 14789 10120
## cor(pressure_partner_cw,pushing_partner_cw) 10499 11271
## cor(pushing_self_cw,pushing_partner_cw) 11841 10281
##
## Regression Coefficients:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS
## Intercept 0.67 0.13 0.42 0.91 1.00 12391
## persuasion_self_cw -0.05 0.03 -0.10 0.01 1.00 16431
## persuasion_partner_cw 0.00 0.03 -0.06 0.07 1.00 14098
## pressure_self_cw 0.25 0.11 0.03 0.47 1.00 8878
## pressure_partner_cw 0.14 0.11 -0.06 0.37 1.00 8820
## pushing_self_cw 0.09 0.04 0.01 0.18 1.00 11133
## pushing_partner_cw -0.01 0.04 -0.10 0.08 1.00 15988
## isWeekendWeekend -0.14 0.08 -0.30 0.01 1.00 20346
## got_JITAI_selfJITAIreceived 0.00 0.11 -0.20 0.22 1.00 16729
## skilled_supportDaysafterIntervention -0.10 0.13 -0.36 0.15 1.00 11974
## persuasion_self_cb 0.05 0.17 -0.29 0.39 1.00 9115
## persuasion_partner_cb 0.10 0.19 -0.28 0.48 1.00 9206
## pressure_self_cb 0.60 0.20 0.22 0.99 1.00 11067
## pressure_partner_cb 0.19 0.21 -0.23 0.60 1.00 9480
## pushing_self_cb -0.20 0.26 -0.70 0.30 1.00 10403
## pushing_partner_cb -0.54 0.27 -1.08 0.00 1.00 12417
## studyGroupFirst3weeksinterventions 0.08 0.13 -0.19 0.34 1.00 10558
## studyGrouplast3weeksinterventions -0.32 0.14 -0.59 -0.04 1.00 9283
## day 0.16 0.19 -0.20 0.53 1.00 12724
## Tail_ESS
## Intercept 9622
## persuasion_self_cw 9721
## persuasion_partner_cw 9325
## pressure_self_cw 8057
## pressure_partner_cw 8116
## pushing_self_cw 9362
## pushing_partner_cw 10163
## isWeekendWeekend 8422
## got_JITAI_selfJITAIreceived 9378
## skilled_supportDaysafterIntervention 9353
## persuasion_self_cb 9242
## persuasion_partner_cb 9564
## pressure_self_cb 9102
## pressure_partner_cb 8465
## pushing_self_cb 9198
## pushing_partner_cb 9838
## studyGroupFirst3weeksinterventions 9458
## studyGrouplast3weeksinterventions 8654
## day 8502
##
## Further Distributional Parameters:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sigma 0.93 0.03 0.88 0.98 1.00 12595 8490
##
## Draws were sampled using sample(hmc). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
summarize_brms(
reactance,
model_rows_fixed = model_rows_fixed,
model_rows_random = model_rows_random,
model_rownames_fixed = model_rownames_fixed,
model_rownames_random = model_rownames_random,
exponentiate = F) %>%
print_df(rows_to_pack = rows_to_pack)
|
|
b
|
l-95% CI
|
u-95% CI
|
Rhat
|
Bulk_ESS
|
Tail_ESS
|
|
Intercept
|
0.67*
|
0.42
|
0.91
|
1.000
|
12391.46
|
9621.83
|
|
Within-Person Effects
|
|
Daily perceived persuasion target -> target
|
-0.05
|
-0.10
|
0.01
|
1.000
|
16431.02
|
9720.80
|
|
Daily perceived persuasion target -> agent
|
0.00
|
-0.06
|
0.07
|
1.001
|
14097.52
|
9324.77
|
|
Daily perceived pressure target -> target
|
0.25*
|
0.03
|
0.47
|
1.000
|
8878.47
|
8057.12
|
|
Daily perceived pressure target -> agent
|
0.14
|
-0.06
|
0.37
|
1.000
|
8819.52
|
8115.90
|
|
Daily perceived pushing target -> target
|
0.09*
|
0.01
|
0.18
|
1.000
|
11132.58
|
9362.05
|
|
Daily perceived pushing target -> agent
|
-0.01
|
-0.10
|
0.08
|
1.000
|
15987.84
|
10163.24
|
|
Day
|
0.16
|
-0.20
|
0.53
|
1.001
|
12724.02
|
8501.67
|
|
Daily weartime
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Daily perceived support target -> target
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Daily perceived support target -> agent
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Is a weekend
|
-0.14
|
-0.30
|
0.01
|
1.001
|
20345.67
|
8422.39
|
|
JITAI received
|
0.00
|
-0.20
|
0.22
|
1.000
|
16728.88
|
9377.54
|
|
Days post skilled support intervention
|
-0.10
|
-0.36
|
0.15
|
1.000
|
11973.55
|
9353.34
|
|
Between-Person Effects
|
|
Mean perceived persuasion target -> target
|
0.05
|
-0.29
|
0.39
|
1.001
|
9114.74
|
9242.49
|
|
Mean Perceived persuasion target -> agent
|
0.10
|
-0.28
|
0.48
|
1.001
|
9206.41
|
9563.53
|
|
Mean Perceived pressure target -> target
|
0.60*
|
0.22
|
0.99
|
1.000
|
11067.40
|
9102.09
|
|
Mean Perceived pressure target -> agent
|
0.19
|
-0.23
|
0.60
|
1.001
|
9479.52
|
8465.23
|
|
Mean Perceived pushing target -> target
|
-0.20
|
-0.70
|
0.30
|
1.000
|
10402.72
|
9197.52
|
|
Mean Perceived pushing target -> agent
|
-0.54
|
-1.08
|
0.00
|
1.000
|
12417.03
|
9838.03
|
|
Mean weartime
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Difference study group 2
|
0.08
|
-0.19
|
0.34
|
1.001
|
10557.83
|
9457.88
|
|
Difference study group 3
|
-0.32*
|
-0.59
|
-0.04
|
1.000
|
9282.86
|
8654.37
|
|
Random Effects
|
|
sd(Intercept)
|
0.19
|
0.04
|
0.36
|
1.00
|
3431.34
|
2861.82
|
|
sd(Daily perceived persuasion target -> target)
|
0.04
|
0.00
|
0.11
|
1.00
|
3634.34
|
5167.11
|
|
sd(Daily perceived persuasion target -> agent)
|
0.05
|
0.00
|
0.13
|
1.00
|
5652.48
|
5644.07
|
|
sd(Daily perceived pressure target -> target)
|
0.40
|
0.23
|
0.62
|
1.00
|
6501.66
|
8218.15
|
|
sd(Daily perceived pressure target -> agent)
|
0.22
|
0.01
|
0.58
|
1.00
|
3086.62
|
6599.12
|
|
sd(Daily perceived pushing target -> target)
|
0.12
|
0.01
|
0.24
|
1.00
|
3834.07
|
4179.69
|
|
sd(Daily perceived pushing target -> agent)
|
0.05
|
0.00
|
0.15
|
1.00
|
7144.19
|
6969.82
|
|
Additional Parameters
|
|
ar[1]
|
0.01
|
-0.08
|
0.09
|
1.00
|
14667.35
|
9441.44
|
|
nu
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
shape
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
sderr
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
sigma
|
0.93
|
0.88
|
0.98
|
1.00
|
12594.89
|
8490.33
|
Binary Version
introduce_binary_reactance <- function(data) {
data$is_reactance <- factor(data$reactance > 0, levels = c(FALSE, TRUE), labels = c(0, 1))
return(data)
}
df_double <- introduce_binary_reactance(df_double)
if (use_mi) {
for (i in seq_along(implist)) {
implist[[i]] <- introduce_binary_reactance(implist[[i]])
}
}
formula <- bf(
is_reactance ~
persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw +
#barriers_self_cw +
#support_self_cw + support_partner_cw + support_partner_cw +
#comf_self_cw + reas_self_cw +
isWeekend +
got_JITAI_self + skilled_support +
persuasion_self_cb + persuasion_partner_cb +
pressure_self_cb + pressure_partner_cb +
pushing_self_cb + pushing_partner_cb +
studyGroup +
day +
# Random effects
(persuasion_self_cw + persuasion_partner_cw +
pressure_self_cw + pressure_partner_cw +
pushing_self_cw + pushing_partner_cw | coupleID),
autocor = ~ ar(time = day, gr = coupleID:userID, p = 1)
)
prior1 <- c(
brms::set_prior("normal(0, 5)", class = "b"),
brms::set_prior("normal(0, 20)", class = "Intercept", lb=0, ub=5), # range of the outcome scale
brms::set_prior("normal(0, 2)", class = "sd", group = "coupleID", lb = 0),
brms::set_prior("cauchy(0, 5)", class = "ar", lb = -1, ub = 1)
#brms::set_prior("cauchy(0, 10)", class = "sigma", lb = 0)
)
df_minimal <- df_double[, c("userID", all.vars(as.formula(formula)))]
is_reactance <- my_brm(
mi = use_mi,
imputed_data = implist,
formula = formula,
prior = prior1,
data = df_double,
family = bernoulli(),
#control = list(adapt_delta = 0.95, max_treedepth = 15),
iter = 5000,
warmup = 2000,
chains = 4,
cores = 4,
seed = 7777,
file = file.path(working_directory,"models_cache", "NoExchangeProcesses_is_reactance")
)
pp_check(is_reactance, type='hist')
## Using 10 posterior draws for ppc type 'hist' by default.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## Using 10 posterior draws for ppc type 'dens_overlay' by default.

##
## Computed from 12000 by 756 log-likelihood matrix.
##
## Estimate SE
## elpd_loo -381.8 15.2
## p_loo 340.2 14.1
## looic 763.6 30.5
## ------
## MCSE of elpd_loo is NA.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.6, 1.2]).
##
## Pareto k diagnostic values:
## Count Pct. Min. ESS
## (-Inf, 0.7] (good) 1 0.1% 1672
## (0.7, 1] (bad) 205 27.1% <NA>
## (1, Inf) (very bad) 550 72.8% <NA>
## See help('pareto-k-diagnostic') for details.
plot(is_reactance, ask = FALSE)










summarize_brms(
is_reactance,
model_rows_fixed = model_rows_fixed,
model_rows_random = model_rows_random,
model_rownames_fixed = model_rownames_fixed,
model_rownames_random = model_rownames_random,
exponentiate = T) %>%
print_df(rows_to_pack = rows_to_pack)
|
|
OR
|
l-95% CI
|
u-95% CI
|
Rhat
|
Bulk_ESS
|
Tail_ESS
|
|
Intercept
|
0.01*
|
0.00
|
0.52
|
1.000
|
4271.62
|
5789.86
|
|
Within-Person Effects
|
|
Daily perceived persuasion target -> target
|
0.40
|
0.12
|
1.06
|
1.000
|
4382.90
|
5233.73
|
|
Daily perceived persuasion target -> agent
|
2.67
|
0.64
|
14.82
|
1.001
|
4001.26
|
5115.63
|
|
Daily perceived pressure target -> target
|
36.17*
|
3.45
|
574.77
|
1.000
|
3947.15
|
5161.33
|
|
Daily perceived pressure target -> agent
|
2.91
|
0.15
|
61.16
|
1.000
|
5055.42
|
7063.83
|
|
Daily perceived pushing target -> target
|
4.13*
|
1.15
|
21.32
|
1.000
|
3980.92
|
4941.79
|
|
Daily perceived pushing target -> agent
|
0.59
|
0.09
|
3.64
|
1.000
|
5379.05
|
6850.20
|
|
Day
|
17.46
|
0.10
|
3141.98
|
1.000
|
4786.88
|
6545.99
|
|
Daily weartime
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Daily perceived support target -> target
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Daily perceived support target -> agent
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Is a weekend
|
0.12
|
0.01
|
1.46
|
1.001
|
4950.94
|
6614.60
|
|
JITAI received
|
4.53
|
0.17
|
146.24
|
1.000
|
4576.74
|
6512.60
|
|
Days post skilled support intervention
|
0.36
|
0.01
|
13.76
|
1.000
|
4477.98
|
5635.60
|
|
Between-Person Effects
|
|
Mean perceived persuasion target -> target
|
40.75
|
0.39
|
7889.80
|
1.000
|
4315.16
|
6354.71
|
|
Mean Perceived persuasion target -> agent
|
9.66
|
0.07
|
1430.84
|
1.000
|
4912.01
|
7005.40
|
|
Mean Perceived pressure target -> target
|
17321.32*
|
23.77
|
17522651.97
|
1.001
|
6426.35
|
7682.56
|
|
Mean Perceived pressure target -> agent
|
96.36
|
0.08
|
109105.44
|
1.000
|
5360.49
|
7202.57
|
|
Mean Perceived pushing target -> target
|
5.76
|
0.01
|
6533.77
|
1.000
|
6191.67
|
7824.41
|
|
Mean Perceived pushing target -> agent
|
0.00
|
0.00
|
2.80
|
1.000
|
6873.54
|
7429.09
|
|
Mean weartime
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Difference study group 2
|
4.17
|
0.06
|
334.32
|
1.001
|
4645.68
|
6426.11
|
|
Difference study group 3
|
0.01
|
0.00
|
1.37
|
1.001
|
4632.38
|
6735.22
|
|
Random Effects
|
|
sd(Intercept)
|
4.42
|
2.55
|
6.71
|
1.00
|
3776.24
|
6688.05
|
|
sd(Daily perceived persuasion target -> target)
|
0.89
|
0.04
|
2.33
|
1.00
|
1824.62
|
4403.78
|
|
sd(Daily perceived persuasion target -> agent)
|
2.14
|
0.65
|
3.93
|
1.00
|
3039.73
|
3385.51
|
|
sd(Daily perceived pressure target -> target)
|
2.08
|
0.09
|
5.06
|
1.00
|
1914.70
|
3688.14
|
|
sd(Daily perceived pressure target -> agent)
|
1.48
|
0.06
|
4.12
|
1.00
|
4524.20
|
4585.29
|
|
sd(Daily perceived pushing target -> target)
|
1.30
|
0.11
|
2.96
|
1.00
|
2384.80
|
3571.83
|
|
sd(Daily perceived pushing target -> agent)
|
0.96
|
0.03
|
2.76
|
1.00
|
4667.81
|
5373.75
|
|
Additional Parameters
|
|
ar[1]
|
0.07
|
-0.12
|
0.26
|
1.00
|
1836.22
|
3172.63
|
|
nu
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
shape
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
sderr
|
10.17
|
6.31
|
15.09
|
1.00
|
2318.65
|
4389.53
|
|
sigma
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
Report All Models
if (report_ordinal) {
model_rows_random_final <- model_rows_random_ordinal
model_rows_fixed_final <- model_rows_fixed_ordinal
model_rownames_fixed_final <- model_rownames_fixed_ordinal
model_rownames_random_final <- model_rownames_random_ordinal
rows_to_pack_final <- rows_to_pack_ordinal
} else {
model_rows_random_final <- model_rows_random
model_rows_fixed_final <- model_rows_fixed
model_rownames_fixed_final <- model_rownames_fixed
model_rownames_random_final <- model_rownames_random
rows_to_pack_final <- rows_to_pack
}
all_models <- report_side_by_side(
pa_sub,
pa_obj_log,
mood,
reactance,
is_reactance,
model_rows_random = model_rows_random_final,
model_rows_fixed = model_rows_fixed_final,
model_rownames_random = model_rownames_random_final,
model_rownames_fixed = model_rownames_fixed_final
)
## [1] "pa_sub"
## [1] "pa_obj_log"
## [1] "mood"
## [1] "reactance"
## [1] "is_reactance"
# pretty printing
summary_all_models <- all_models %>%
print_df(rows_to_pack = rows_to_pack_final) %>%
add_header_above(
c(" ", "Subjective MVPA" = 2,
"Device-Based MVPA" = 2,
"Mood" = 2,
"Reactance Gaussian" = 2,
"Reactance Dichotome" = 2)
)
export_xlsx(summary_all_models,
rows_to_pack = rows_to_pack_final,
file.path(working_directory, "Output", "NoExchangeProcesses_AllModels_SensCovariates.xlsx"),
merge_option = 'both',
simplify_2nd_row = TRUE,
colwidths = c(40, 7.4, 12.85, 7.4, 12.85,7.4, 12.85,7.4, 12.85,7.4, 12.85),
line_above_rows = c(1,2,3,28),
line_below_rows = c(-1))
summary_all_models
|
|
Subjective MVPA
|
Device-Based MVPA
|
Mood
|
Reactance Gaussian
|
Reactance Dichotome
|
|
|
IRR pa_sub
|
95% CI pa_sub
|
exp(Est.) pa_obj_log
|
95% CI pa_obj_log
|
b mood
|
95% CI mood
|
b reactance
|
95% CI reactance
|
OR is_reactance
|
95% CI is_reactance
|
|
Intercept
|
25.01*
|
[16.31, 38.47]
|
120.79*
|
[100.83, 145.18]
|
4.64*
|
[ 4.31, 4.97]
|
0.67*
|
[ 0.42, 0.91]
|
0.01*
|
[ 0.00, 0.52]
|
|
Within-Person Effects
|
|
Daily perceived persuasion target -> target
|
1.20*
|
[ 1.08, 1.35]
|
1.03
|
[ 1.00, 1.05]
|
0.00
|
[-0.03, 0.03]
|
-0.05
|
[-0.10, 0.01]
|
0.40
|
[ 0.12, 1.06]
|
|
Daily perceived persuasion target -> agent
|
1.18*
|
[ 1.06, 1.33]
|
1.01
|
[ 0.99, 1.04]
|
0.01
|
[-0.03, 0.05]
|
0.00
|
[-0.06, 0.07]
|
2.67
|
[ 0.64, 14.82]
|
|
Daily perceived pressure target -> target
|
0.93
|
[ 0.70, 1.28]
|
0.95
|
[ 0.89, 1.01]
|
-0.05
|
[-0.17, 0.05]
|
0.25*
|
[ 0.03, 0.47]
|
36.17*
|
[ 3.45, 574.77]
|
|
Daily perceived pressure target -> agent
|
1.17
|
[ 0.88, 1.60]
|
0.98
|
[ 0.92, 1.04]
|
-0.04
|
[-0.18, 0.09]
|
0.14
|
[-0.06, 0.37]
|
2.91
|
[ 0.15, 61.16]
|
|
Daily perceived pushing target -> target
|
1.13
|
[ 0.92, 1.41]
|
1.03
|
[ 0.98, 1.08]
|
0.02
|
[-0.04, 0.09]
|
0.09*
|
[ 0.01, 0.18]
|
4.13*
|
[ 1.15, 21.32]
|
|
Daily perceived pushing target -> agent
|
1.14
|
[ 0.97, 1.36]
|
1.03
|
[ 0.99, 1.07]
|
0.06*
|
[ 0.01, 0.12]
|
-0.01
|
[-0.10, 0.08]
|
0.59
|
[ 0.09, 3.64]
|
|
Day
|
0.78
|
[ 0.51, 1.20]
|
0.94
|
[ 0.83, 1.05]
|
0.21
|
[-0.01, 0.43]
|
0.16
|
[-0.20, 0.53]
|
17.46
|
[ 0.10, 3141.98]
|
|
Daily weartime
|
NA
|
NA
|
1.00*
|
[ 1.00, 1.00]
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Daily perceived support target -> target
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Daily perceived support target -> agent
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Is a weekend
|
1.26*
|
[ 1.03, 1.53]
|
1.06*
|
[ 1.02, 1.11]
|
0.12*
|
[ 0.05, 0.18]
|
-0.14
|
[-0.30, 0.01]
|
0.12
|
[ 0.01, 1.46]
|
|
JITAI received
|
0.78
|
[ 0.60, 1.02]
|
0.93*
|
[ 0.88, 0.98]
|
-0.09*
|
[-0.16, -0.01]
|
0.00
|
[-0.20, 0.22]
|
4.53
|
[ 0.17, 146.24]
|
|
Days post skilled support intervention
|
1.07
|
[ 0.77, 1.47]
|
1.04
|
[ 0.96, 1.14]
|
0.04
|
[-0.11, 0.19]
|
-0.10
|
[-0.36, 0.15]
|
0.36
|
[ 0.01, 13.76]
|
|
Between-Person Effects
|
|
Mean perceived persuasion target -> target
|
1.64
|
[ 0.84, 3.21]
|
1.07
|
[ 0.79, 1.45]
|
0.39
|
[-0.18, 0.94]
|
0.05
|
[-0.29, 0.39]
|
40.75
|
[ 0.39, 7889.80]
|
|
Mean Perceived persuasion target -> agent
|
1.22
|
[ 0.64, 2.35]
|
0.95
|
[ 0.70, 1.29]
|
0.30
|
[-0.26, 0.86]
|
0.10
|
[-0.28, 0.48]
|
9.66
|
[ 0.07, 1430.84]
|
|
Mean Perceived pressure target -> target
|
0.50
|
[ 0.23, 1.09]
|
0.98
|
[ 0.70, 1.37]
|
-0.30
|
[-0.88, 0.27]
|
0.60*
|
[ 0.22, 0.99]
|
17321.32*
|
[23.77, 17522651.97]
|
|
Mean Perceived pressure target -> agent
|
0.44*
|
[ 0.20, 0.96]
|
1.00
|
[ 0.73, 1.38]
|
-0.31
|
[-0.87, 0.26]
|
0.19
|
[-0.23, 0.60]
|
96.36
|
[ 0.08, 109105.44]
|
|
Mean Perceived pushing target -> target
|
1.69
|
[ 0.63, 4.56]
|
1.03
|
[ 0.66, 1.61]
|
0.16
|
[-0.61, 0.92]
|
-0.20
|
[-0.70, 0.30]
|
5.76
|
[ 0.01, 6533.77]
|
|
Mean Perceived pushing target -> agent
|
1.84
|
[ 0.68, 5.27]
|
1.30
|
[ 0.83, 2.03]
|
0.30
|
[-0.46, 1.07]
|
-0.54
|
[-1.08, 0.00]
|
0.00
|
[ 0.00, 2.80]
|
|
Mean weartime
|
NA
|
NA
|
1.00
|
[ 1.00, 1.00]
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
Difference study group 2
|
0.84
|
[ 0.49, 1.44]
|
0.89
|
[ 0.69, 1.15]
|
-0.23
|
[-0.67, 0.21]
|
0.08
|
[-0.19, 0.34]
|
4.17
|
[ 0.06, 334.32]
|
|
Difference study group 3
|
1.27
|
[ 0.74, 2.16]
|
0.98
|
[ 0.75, 1.26]
|
0.37
|
[-0.10, 0.82]
|
-0.32*
|
[-0.59, -0.04]
|
0.01
|
[ 0.00, 1.37]
|
|
Random Effects
|
|
sd(Intercept)
|
0.61
|
[ 0.45, 0.83]
|
0.30
|
[0.23, 0.40]
|
0.55
|
[0.42, 0.72]
|
0.19
|
[ 0.04, 0.36]
|
4.42
|
[ 2.55, 6.71]
|
|
sd(Daily perceived persuasion target -> target)
|
0.09
|
[ 0.00, 0.23]
|
0.05
|
[0.03, 0.08]
|
0.03
|
[0.00, 0.07]
|
0.04
|
[ 0.00, 0.11]
|
0.89
|
[ 0.04, 2.33]
|
|
sd(Daily perceived persuasion target -> agent)
|
0.07
|
[ 0.00, 0.20]
|
0.05
|
[0.02, 0.08]
|
0.06
|
[0.01, 0.11]
|
0.05
|
[ 0.00, 0.13]
|
2.14
|
[ 0.65, 3.93]
|
|
sd(Daily perceived pressure target -> target)
|
0.17
|
[ 0.01, 0.53]
|
0.05
|
[0.00, 0.14]
|
0.12
|
[0.01, 0.29]
|
0.40
|
[ 0.23, 0.62]
|
2.08
|
[ 0.09, 5.06]
|
|
sd(Daily perceived pressure target -> agent)
|
0.16
|
[ 0.01, 0.48]
|
0.04
|
[0.00, 0.11]
|
0.18
|
[0.02, 0.37]
|
0.22
|
[ 0.01, 0.58]
|
1.48
|
[ 0.06, 4.12]
|
|
sd(Daily perceived pushing target -> target)
|
0.28
|
[ 0.02, 0.58]
|
0.06
|
[0.00, 0.15]
|
0.09
|
[0.01, 0.17]
|
0.12
|
[ 0.01, 0.24]
|
1.30
|
[ 0.11, 2.96]
|
|
sd(Daily perceived pushing target -> agent)
|
0.11
|
[ 0.01, 0.31]
|
0.03
|
[0.00, 0.08]
|
0.05
|
[0.00, 0.13]
|
0.05
|
[ 0.00, 0.15]
|
0.96
|
[ 0.03, 2.76]
|
|
Additional Parameters
|
|
ar[1]
|
0.03
|
[-0.94, 0.94]
|
0.30
|
[0.26, 0.33]
|
0.45
|
[0.42, 0.48]
|
0.01
|
[-0.08, 0.09]
|
0.07
|
[-0.12, 0.26]
|
|
nu
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
shape
|
0.14
|
[ 0.13, 0.14]
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
|
sderr
|
0.05
|
[ 0.00, 0.14]
|
NA
|
NA
|
NA
|
NA
|
NA
|
NA
|
10.17
|
[ 6.31, 15.09]
|
|
sigma
|
NA
|
NA
|
0.55
|
[0.54, 0.57]
|
0.87
|
[0.85, 0.89]
|
0.93
|
[ 0.88, 0.98]
|
NA
|
NA
|
Analyses were conducted using the R Statistical language (version
4.3.2; R Core Team, 2023) on Windows 11 x64 (build 22635)
- Allaire J, Xie Y, Dervieux C, McPherson J, Luraschi J, Ushey K,
Atkins A, Wickham H, Cheng J, Chang W, Iannone R (2024). rmarkdown:
Dynamic Documents for R. R package version 2.26, https://github.com/rstudio/rmarkdown. Xie Y, Allaire J,
Grolemund G (2018). R Markdown: The Definitive Guide. Chapman
and Hall/CRC, Boca Raton, Florida. ISBN 9781138359338, https://bookdown.org/yihui/rmarkdown. Xie Y, Dervieux C,
Riederer E (2020). R Markdown Cookbook. Chapman and Hall/CRC,
Boca Raton, Florida. ISBN 9780367563837, https://bookdown.org/yihui/rmarkdown-cookbook.
- Bengtsson H (2003). “The R.oo package - Object-Oriented Programming
with References Using Standard R Code.” In Hornik K, Leisch F, Zeileis A
(eds.), Proceedings of the 3rd International Workshop on Distributed
Statistical Computing (DSC 2003). https://www.r-project.org/conferences/DSC-2003/Proceedings/Bengtsson.pdf.
- Bengtsson H (2003). “The R.oo package - Object-Oriented Programming
with References Using Standard R Code.” In Hornik K, Leisch F, Zeileis A
(eds.), Proceedings of the 3rd International Workshop on Distributed
Statistical Computing (DSC 2003). https://www.r-project.org/conferences/DSC-2003/Proceedings/Bengtsson.pdf.
- Bengtsson H (2023). R.utils: Various Programming Utilities.
R package version 2.12.3, https://CRAN.R-project.org/package=R.utils.
- Bürkner P (2017). “brms: An R Package for Bayesian Multilevel Models
Using Stan.” Journal of Statistical Software, 80(1),
1-28. doi:10.18637/jss.v080.i01 https://doi.org/10.18637/jss.v080.i01. Bürkner P (2018).
“Advanced Bayesian Multilevel Modeling with the R Package brms.” The
R Journal, 10(1), 395-411. doi:10.32614/RJ-2018-017
https://doi.org/10.32614/RJ-2018-017. Bürkner P (2021).
“Bayesian Item Response Modeling in R with brms and Stan.” Journal
of Statistical Software, 100(5), 1-54. doi:10.18637/jss.v100.i05 https://doi.org/10.18637/jss.v100.i05.
- Eddelbuettel D, Francois R, Allaire J, Ushey K, Kou Q, Russell N,
Ucar I, Bates D, Chambers J (2024). Rcpp: Seamless R and C++
Integration. R package version 1.0.12, https://CRAN.R-project.org/package=Rcpp. Eddelbuettel D,
François R (2011). “Rcpp: Seamless R and C++ Integration.” Journal
of Statistical Software, 40(8), 1-18. doi:10.18637/jss.v040.i08 https://doi.org/10.18637/jss.v040.i08. Eddelbuettel D
(2013). Seamless R and C++ Integration with Rcpp. Springer, New
York. doi:10.1007/978-1-4614-6868-4 https://doi.org/10.1007/978-1-4614-6868-4, ISBN
978-1-4614-6867-7. Eddelbuettel D, Balamuta J (2018). “Extending R with
C++: A Brief Introduction to Rcpp.” The American Statistician,
72(1), 28-36. doi:10.1080/00031305.2017.1375990 https://doi.org/10.1080/00031305.2017.1375990.
- Gabry J, Mahr T (2024). “bayesplot: Plotting for Bayesian Models.” R
package version 1.11.1, https://mc-stan.org/bayesplot/. Gabry J, Simpson D,
Vehtari A, Betancourt M, Gelman A (2019). “Visualization in Bayesian
workflow.” J. R. Stat. Soc. A, 182, 389-402. doi:10.1111/rssa.12378 https://doi.org/10.1111/rssa.12378.
- Grolemund G, Wickham H (2011). “Dates and Times Made Easy with
lubridate.” Journal of Statistical Software, 40(3),
1-25. https://www.jstatsoft.org/v40/i03/.
- Hester J, Wickham H, Csárdi G (2024). fs: Cross-Platform File
System Operations Based on ‘libuv’. R package version 1.6.4, https://CRAN.R-project.org/package=fs.
- Küng P (2023). wbCorr: Bivariate Within- and Between-Cluster
Correlations. University of Zürich. R package version 0.1.22. https://github.com/Pascal-Kueng/wbCorr.
- Müller K, Wickham H (2023). tibble: Simple Data Frames. R
package version 3.2.1, https://CRAN.R-project.org/package=tibble.
- R Core Team (2023). R: A Language and Environment for
Statistical Computing. R Foundation for Statistical Computing,
Vienna, Austria. https://www.R-project.org/.
- Schauberger P, Walker A (2023). openxlsx: Read, Write and Edit
xlsx Files. R package version 4.2.5.2, https://CRAN.R-project.org/package=openxlsx.
- Wickham H (2016). ggplot2: Elegant Graphics for Data
Analysis. Springer-Verlag New York. ISBN 978-3-319-24277-4, https://ggplot2.tidyverse.org.
- Wickham H (2023). forcats: Tools for Working with Categorical
Variables (Factors). R package version 1.0.0, https://CRAN.R-project.org/package=forcats.
- Wickham H (2023). stringr: Simple, Consistent Wrappers for
Common String Operations. R package version 1.5.1, https://CRAN.R-project.org/package=stringr.
- Wickham H (2024). rvest: Easily Harvest (Scrape) Web Pages.
R package version 1.0.4, https://CRAN.R-project.org/package=rvest.
- Wickham H, Averick M, Bryan J, Chang W, McGowan LD, François R,
Grolemund G, Hayes A, Henry L, Hester J, Kuhn M, Pedersen TL, Miller E,
Bache SM, Müller K, Ooms J, Robinson D, Seidel DP, Spinu V, Takahashi K,
Vaughan D, Wilke C, Woo K, Yutani H (2019). “Welcome to the tidyverse.”
Journal of Open Source Software, 4(43), 1686. doi:10.21105/joss.01686
https://doi.org/10.21105/joss.01686.
- Wickham H, Bryan J (2023). readxl: Read Excel Files. R
package version 1.4.3, https://CRAN.R-project.org/package=readxl.
- Wickham H, François R, Henry L, Müller K, Vaughan D (2023).
dplyr: A Grammar of Data Manipulation. R package version 1.1.4,
https://CRAN.R-project.org/package=dplyr.
- Wickham H, Henry L (2023). purrr: Functional Programming
Tools. R package version 1.0.2, https://CRAN.R-project.org/package=purrr.
- Wickham H, Hester J, Bryan J (2024). readr: Read Rectangular
Text Data. R package version 2.1.5, https://CRAN.R-project.org/package=readr.
- Wickham H, Hester J, Ooms J (2023). xml2: Parse XML. R
package version 1.3.6, https://CRAN.R-project.org/package=xml2.
- Wickham H, Vaughan D, Girlich M (2024). tidyr: Tidy Messy
Data. R package version 1.3.1, https://CRAN.R-project.org/package=tidyr.
- Xie Y (2024). knitr: A General-Purpose Package for Dynamic
Report Generation in R. R package version 1.46, https://yihui.org/knitr/. Xie Y (2015). Dynamic
Documents with R and knitr, 2nd edition. Chapman and Hall/CRC, Boca
Raton, Florida. ISBN 978-1498716963, https://yihui.org/knitr/. Xie Y (2014). “knitr: A
Comprehensive Tool for Reproducible Research in R.” In Stodden V, Leisch
F, Peng RD (eds.), Implementing Reproducible Computational
Research. Chapman and Hall/CRC. ISBN 978-1466561595.
- Zhu H (2024). kableExtra: Construct Complex Table with ‘kable’
and Pipe Syntax. R package version 1.4.0, https://CRAN.R-project.org/package=kableExtra.